feat(vulkan): allow specifying queue family ownership transfer in texture barriers#9668
Open
alexander-bruun wants to merge 1 commit into
Conversation
…ture barriers
Images imported from external memory must have their backing image's queue
family ownership transferred from a sentinel queue family (FOREIGN/EXTERNAL)
to wgpu's queue family on acquire, and transferred back on release. The
Vulkan HAL previously built image memory barriers without ever setting
src/dst queue family indices, so this was impossible to express.
Add an optional `queue_family_ownership_transfer` field to the
backend-agnostic `hal::TextureBarrier`. It is honored only by the Vulkan
backend (which now sets `src/dstQueueFamilyIndex` on the
`VkImageMemoryBarrier`); all other backends ignore it. When unset, both
indices default to `VK_QUEUE_FAMILY_IGNORED`, preserving existing behavior.
Expose `hal::QUEUE_FAMILY_{IGNORED,EXTERNAL,FOREIGN}` sentinels (with a
compile-time assertion that they match ash's values) so callers using
`vulkan::Device::queue_family_index()` can build acquire/release transfers
without depending on ash directly.
Resolves gfx-rs#2948.
8169962 to
984d3f0
Compare
Collaborator
|
CC @atlv24 :))) As for this PR, we actually plan to implement multiqueue ourselves so QFOTs would be part of that. As for now this is only an unsafe hal interop thing for one API, I would be agaInst putting it in a normal wgpu api like barriers. Finally, even if this were correct, it would probably have to be implemented for all barriers. Happy to discuss this further, I think there is some way to make this work before multiqueue lands. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections
Resolves #2948.
Description
Adds an optional
queue_family_ownership_transferfield tohal::TextureBarrierso textures imported from external memory can be acquired from / released back to a sentinel queue family. Honored only by the Vulkan backend (setssrc/dstQueueFamilyIndexon the image barrier); all other backends ignore it. WhenNone(every existing caller) the indices default toVK_QUEUE_FAMILY_IGNORED, so behavior is unchanged.Also exposes
hal::QUEUE_FAMILY_{IGNORED,EXTERNAL,FOREIGN}sentinels so callers don't need a directashdependency.Testing
cargo check -p wgpu-hal --features vulkan --all-targetsandcargo check -p wgpu-core --features vulkan.ash.Squash or Rebase?
Single commit, ready to rebase onto
trunkas-is.